{extend name="../../admin/view/common/main"/}
{block name="style"}
<link href="__ADMIN_CSS__/main.min.css" type="text/css" rel="stylesheet">
{/block}

{block name="body"}
<ol class="breadcrumb">
	<i class="icon icon-angle-left"></i>
	<li>
		<a href="{:url('lists')}">文章管理</a>
	</li>
	<li>
		文章列表
	</li>
</ol>


<div class="search-box clearfix margin-bottom row">

	<form action="{:url('lists')}" method="get" class="search-form" role="form">
		<div class="col-sm-2">
			<select name="category_id" class="form-control">
				<option value="0">全部分类</option>
				{volist name="$category_tree" id="v"}
				{if $category_id == $v['id']}
				<option selected value="{$v['id']}">{$v['title']}</option>
				{else}
				<option value="{$v['id']}">{$v['title']}</option>
				{/if}
				{if (!empty($v._child))}
				{volist name="$v._child" id="_v"}
				{if $category_id == $_v['id']}
				<option selected value="{$v['id']}">|----{$_v['title']}</option>
				{else}
				<option value="{$v['id']}">|----{$_v['title']}</option>
				{/if}
				{/volist}
				{/if}
				{/volist}
			</select>
		</div>
		<div class="col-sm-3">
			<div class="input-group">
				<div class="input-control search-box has-icon-left has-icon-right">
					<input class="form-control" name="keyword" placeholder="关键字" id="" type="text" value="{$keyword}">
					<label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>
				</div>
				<span class="input-group-btn">
					<button class="btn btn-primary" type="submit">搜索</button>
				</span>
			</div>
		</div>
	</form>
</div>
<div class="action-btn-box margin-bottom">
	<a class="btn btn-primary margin-right" href="{:url('edit')}" role="button">+ 新增文章</a>
	<button class="btn ajax-post btn-info confirm margin-right" 
		url="{:url('status',['status' => 1])}" 
		target-form="ids"
	>
		启用
	</button>
	<button class="btn ajax-post btn-warning confirm margin-right" 
		url="{:url('status',['status' => 0])}" 
		target-form="ids"
	>
		禁用
	</button>
	<button class="btn ajax-post btn-danger margin-right confirm" 
		data-confirm="您确实要删除吗？（删除后不可恢复）" 
		url="{:url('status',['status' => -3])}" 
		target-form="ids"
	>
		删除
	</button>
</div>

<section class="article-list-section clearfix">

	<div class="item-section card">
		{if empty($lists.data)}
		{include file="admin/common/_empty"/}
		{else /}
		<table class="table muu-table">
			<thead>
				<tr>
					<th width="40">
						<input type="checkbox" class="check-all" id="check-all">
						<label for="check-all"></label>
					</th>
					<th>标题</th>
					<th>排序</th>
					<th>状态</th>
					<th>创建时间</th>
					<th>更新时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				{foreach $lists.data as $k => $v}
				<tr>
					<td>
						<input type="checkbox" class="ids" name="ids[]" id="a_{$v['id']}" value="{$v['id']}">
						<label for="a_{$v['id']}"></label>
					</td>
					<td>
						<div class="cover">
							<img src="{$v['cover_400']}">
						</div>
						<div class="info">
							<div class="title text-ellipsis" title="{$v['title']}">{$v['title']}</div>
							<div class="description text-ellipsis-2">{$v['description']}</div>
						</div>
					</td>
					<td>
						{$v.sort}
					</td>
					<td>
						{if $v.status == 1}
						<span class="label label-success">{$v['status_str']}</span>
						{/if}
						{if $v.status == 0}
						<span class="label label-warning">{$v['status_str']}</span>
						{/if}
						{if $v.status == -1}
						<span class="label label-default">{$v['status_str']}</span>
						{/if}
						{if $v.status == -2}
						<span class="label label-danger">{$v['status_str']}</span>
						{/if}
					</td>
					<td>
						{$v['create_time_str']}
					</td>
					<td>
						{$v['update_time_str']}
					</td>
					<td class="action">
						<div >
							<a href="{:url('edit',['id'=>$v['id']])}" class="btn btn-sm btn-primary">编辑</a>
							{if $v['status'] == 1}
								<a href="{:url('status',['ids'=>$v['id'],'status'=> 0])}" class="btn btn-sm btn-warning ajax-get">禁用</a>
							{/if}
			
							{if $v['status'] == 0}
								<a href="{:url('status', ['ids'=>$v['id'], 'status'=> 1])}" class="btn btn-sm btn-info ajax-get">启用</a>
							{/if}
			
							{if $v['status'] == -1}
								<button class="btn btn-sm btn-warning" data-remote="{:url('verify',['id'=>$v['id']])}" data-toggle="modal" data-title="状态审核">未审核</button>
							{/if}
							{if $v['status'] == -2}
								<button disabled class="btn btn-sm disabled">审核未通过</button>
							{/if}
							<a href="{:url('admin.comment/lists', ['article_id'=>$v['id']])}" class="btn btn-sm btn-success"> 评论</a>
							<a href="{:url('status', ['ids'=>$v['id'], 'status'=> -3])}" data-confirm="确认执行删除操作？" class="btn btn-sm btn-danger ajax-get"><i class="fa fa-times"></i> 删除</a>
						</div>
					</td>
				</tr>
				{/foreach}
			</tbody>
		</table>
		{/if}
	</div>
</section>
	
<div class="page-section">
	{:htmlspecialchars_decode($pager)}
</div>
{include file="admin/common/_preview" /}
{/block}
{block name="script"}
<script src="__ADMIN_JS__/main.min.js"></script>
{/block}
